package org.ejc.struts.admin;

import org.apache.struts.validator.ValidatorForm;
import org.ejc.persist.model.ConventionExecutive;
import org.ejc.persist.model.LanguageIso;

/**
 * Form for registrant.
 * 
 * @author Brian Boyle
 * 
 * @struts.form name="createExecutiveForm"
 */
public class CreateExecutiveForm extends ValidatorForm {

	
	private String firstName;
	private String lastName;
	private String userName;
	private String password1;
	private String password2;
	private boolean administrator;
	private Integer languageId;
	private Integer executiveId;
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public CreateExecutiveForm() {
		super();
	}

	/**
	 * @return Returns the serialVersionUID.
	 */
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	/**
	 * @return Returns the administrator.
	 */
	public boolean getAdministrator() {
		return administrator;
	}

	/**
	 * @param administrator The administrator to set.
	 */
	public void setAdministrator(boolean administrator) {
		this.administrator = administrator;
	}

	/**
	 * @return Returns the firstName.
	 */
	public String getFirstName() {
		return firstName;
	}

	/**
	 * @param firstName The firstName to set.
	 * @struts.validator type="required"
	 * @struts.validator-args arg0resource="page.registration.firstName"
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * @return Returns the languageId.
	 */
	public Integer getLanguageId() {
		return languageId;
	}

	/**
	 * @param languageId The languageId to set.
	 */
	public void setLanguageId(Integer languageId) {
		this.languageId = languageId;
	}

	/**
	 * @return Returns the lastName.
	 */
	public String getLastName() {
		return lastName;
	}

	/**
	 * @param lastName The lastName to set.
     * @struts.validator type="required"
	 * @struts.validator-args arg0resource="page.registration.lastName"
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * @return Returns the password1.
	 */
	public String getPassword1() {
		return password1;
	}

	/**
	 * @param password1 The password1 to set.
	 * @struts.validator type="required"
	 * @struts.validator-args arg0resource="page.execcreate.password"
	 */
	public void setPassword1(String password1) {
		this.password1 = password1;
	}

	/**
	 * @return Returns the password2.
	 * 
	 * 
	 */
	public String getPassword2() {
		return password2;
	}

	/**
	 * @param password2 The password2 to set.
	 * @struts.validator type="required"
	 * @struts.validator-args arg0resource="page.execcreate.password"
	 */
	public void setPassword2(String password2) {
		this.password2 = password2;
	}

	/**
	 * @return Returns the userName.
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * @param userName The userName to set.
	 * @struts.validator type="required"
	 * @struts.validator-args arg0resource="page.execcreate.username"
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	public ConventionExecutive copyToExecutive(){
		ConventionExecutive exec=new ConventionExecutive();
		exec.setUsername(userName);
		exec.setFirstName(firstName);
		exec.setLastName(lastName);
		exec.setPassWord(password1);
		exec.setPhoto(null);
		exec.setAdmin(administrator);
		LanguageIso iso=new LanguageIso();
		iso.setLanguageId(languageId);
		exec.setLanguageIso(iso);
		if(executiveId!=null && executiveId!=0){
			exec.setExecutiveId(executiveId);
		}
		
		
		return exec;
	}

	public Integer getExecutiveId() {
		return executiveId;
	}

	public void setExecutiveId(Integer executiveId) {
		this.executiveId = executiveId;
	}
	
	

}
